﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xiezl.Common.Data;
using Xiezl.Common.Repositorys;
using Xiezl.Common.LinqEx;

namespace Xiezl.Common.Entity
{
    public class SysService
    {
        /// <summary>
        /// 查询获取产品数据
        /// </summary>
        /// <param name="queryParam">查询参数</param>
        /// <param name="total">返回符合条件的记录总数</param>
        /// <returns></returns>
        public IList<Product> GetProductList(EFQueryParam<Product> queryParam, out int total)
        {
            total = 0;
            IList<Product> lst = null;
            using (var repository = new Repository<Product>())
            {
                lst = repository.Include(o => o.ProductCategory).Get(queryParam, out total).ToList();
            }
            if (lst != null)
                lst = lst.Select(o => o.GetJsonEntity()).ToList();
            return lst;
        }
    }
}
